/**
 * @author 陈泰来
 * @version V1.0
 * @Project echo-java-base
 * @Title 栈溢出
 * @Description *
 * @Package jvm.exception
 * @date 2021/3/25 11:39 上午
 * @Copyright:学如逆水行舟，不进则退 .
 */
package jvm.exception;

public class JavaVMStackSOF {

    private static int stackLenght = 1;

    //递归 调用方法
    public void stackLeak() {
        stackLenght++;
        stackLeak();
    }

    public static void main(String[] args) {
        JavaVMStackSOF javaVMStackSOF = new JavaVMStackSOF();
        try {
            javaVMStackSOF.stackLeak();
        } catch (Throwable a) {
            System.out.println("方法栈深度:" + stackLenght);
            a.printStackTrace();
        }
    }
}
